<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css">


  <meta name="keywords" content="uchuhimo, java, kotlin, C++, python, 数据流, dataflow, 分布式, 大数据, bigdata, 深度学习">





  <link rel="alternate" href="/atom.xml" title="King blog" type="application/atom+xml">




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2">






<meta property="og:type" content="website">
<meta property="og:title" content="King blog">
<meta property="og:url" content="https://zhongxc.cc/page/5/index.html">
<meta property="og:site_name" content="King blog">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="King blog">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.2',
    sidebar: {"position":"right","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://zhongxc.cc/page/5/">





  <title>King blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-right 
  page-home">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">King blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description"></h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
  <section id="posts" class="posts-expand">
    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/93d9d9e4.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/93d9d9e4.html" itemprop="url">solr启动时设置jvm内存</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-10-19T16:03:30+08:00">
                2020-10-19
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h4 id="solr启动时设置jvm内存-防止大数据量查询等操作崩溃">solr启动时设置jvm内存，防止大数据量查询等操作崩溃</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./solr start -p 8987 -force -m 2g</span><br></pre></td></tr></table></figure>
<p>为虚拟机分配2g内存</p>
<p><a href="https://github.com/zenghao0219/seat-select" target="_blank" rel="noopener">https://github.com/zenghao0219/seat-select</a></p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/8dc87119.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/8dc87119.html" itemprop="url">vue编译打包出现的问题</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-10-19T09:30:36+08:00">
                2020-10-19
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2022-09-28T18:11:27+08:00">
                2022-09-28
              </time>
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Vue/" itemprop="url" rel="index">
                    <span itemprop="name">Vue</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p>打包到生产环境，woff字体引用的问题</p>
<p>打包完的 css 文件是这样的</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/static/fonts/element-icons.535877f.woff</span><br></pre></td></tr></table></figure>
<p><code>css</code> 所在路径是 <code>/static/css/</code>，而加上上面的相对路径，就变成<code>/static/css/+/static/fonts/element-icons.535877f.woff</code>=<code>/static/css/static/fonts/element-icons.535877f.woff</code>导致加载出现404错误，解决办法</p>
<p><strong>版本信息</strong></p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">	<span class="attr">"webpack"</span>: <span class="string">"3.6.0"</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>在<code>webpack</code>中可以配置<code>publicPath</code>来解决</p>
<p>/build/utils.js</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">if (options.extract) &#123;</span><br><span class="line">    return ExtractTextPlugin.extract(&#123;</span><br><span class="line">        use: loaders,</span><br><span class="line">        fallback: &apos;vue-style-loader&apos;,</span><br><span class="line">        publicPath: &apos;../../&apos;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125; else &#123;</span><br><span class="line">    return [&apos;vue-style-loader&apos;].concat(loaders);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>引用自</p>
<p><a href="https://github.com/iview/iview/issues/515" target="_blank" rel="noopener">https://github.com/iview/iview/issues/515</a></p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/74cfff3f.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/74cfff3f.html" itemprop="url">nginx图标字体文件404问题</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-10-19T09:22:53+08:00">
                2020-10-19
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p>前端项目部署好之后，打开发现字体文件以及图标文件404错误</p>
<p><strong>解决办法</strong></p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">location</span> <span class="regexp">~* \.(eot|otf|ttf|woff)$</span> &#123;</span><br><span class="line">    <span class="attribute">root</span>       html;</span><br><span class="line">    <span class="attribute">add_header</span> Access-Control-Allow-Origin *;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>再次重启nginx，加载成功</p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/f648c982.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/f648c982.html" itemprop="url">MySQL为什么需要一个主键</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-16T14:47:37+08:00">
                2020-09-16
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p><strong>主键</strong></p>
<p>表中每一行都应该有可以唯一标识自己的一列</p>
<p>主键，其能够唯一区分表中的每个行</p>
<p>虽然并不总是需要主键，但大多数情况下都应保证每个表都有一个主键，便于以后数据的操作和管理</p>
<p>表中的任何列都可以作为主键，主要它满足以下条件：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">任何两行都不能有相同的主键值</span><br><span class="line">每个行都必须具有一个主键值（主键列不允许NULL值）</span><br></pre></td></tr></table></figure>
<p><strong>主键值的规范</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">不能更新主键列的值</span><br><span class="line">不重用主键列的值</span><br><span class="line">不在主键列中使用可能会更改的值（例如使用一个名字来作为主键标识某个供应商，供应商如果名字被修改，则必须更改这个主键）</span><br></pre></td></tr></table></figure>
<p><strong>无特殊需求下<code>Innodb</code>建议使用与业务无关的自增ID作为主键</strong></p>
<p><code>InnoDB</code>引擎使用聚集索引，数据记录本身被存于主索引（一颗 B+Tree）的叶子节点上，这就要求同一个叶子节点内（大小为一个内存页或磁盘页）的各条数据记录按主键顺序存放，因此每当有一条新的记录插入时，MySQL会根据其主键将其插入适当的节点和位置，如果页面达到装载因子（InnoDB默认为15/16），则开辟一个新的页（节点）</p>
<p>如果表使用自增主键，那么每次插入新的记录，记录就会顺序添加到当前索引节点的后续位置，当一页写满，就会自动开辟一个新的页</p>
<p>这样就会形成一个紧凑的索引结构，近似顺序填满，由于每次插入时也不需要移动已有的数据，因此效率很高，也不会增加很多开销在维护索引上。</p>
<p>如果使用非自增主键（如果身份证号或学号等），由于每次插入主键的值近似于随机，因此每次新记录都要被插到现有索引页的中间某个位置，此时MySQL不得不为了将新记录插到合适位置而移动数据，甚至目标页面可能已经被回写到磁盘上而从缓存中清掉，此时又要从磁盘上读回来，这增加了很多开销，同时频繁的移动，分页操作造成了大量的碎片，得到了不够紧凑的索引结构，后续不得不通过<code>optimize table</code>来重建表并优化填充页面。</p>
<p><strong>在使用InnoDB存储引擎时，如果没有特别的需要，请永远使用一个与业务无关的自增字段作为主键</strong></p>
<p><strong>MySQL 在频繁的更新、删除操作，会产生碎片。而含碎片比较大的表，查询效率会降低。此时需对表进行优化，这样才会使查询变得更有效率。</strong></p>
<p>InnDB与MyISAM区别？索引结构如何实现的</p>
<p>InnDB 是采用B+树来组织的数据，叶子节点DATA包含了索引和数据，索引和Data在磁盘上都是存放在同一个文件中</p>
<p>MyISAM也是采用B+树来组织数据，但是叶子节点只存储了地址，Data数据存放在单独文件中</p>
<p>SQL查询流程</p>
<p>首先判断where条件查询的字段是否为主键，如果是主键，先判断要查询的id在根叔节点那个位置，然后在找到对应的叶子节点，如果是表InnDB类型，那么直接当前Data节点找到数据返回，否则MyISAM类型的话，会先找到叶子节点中存放的地址，然后通过地址在Data文件中找到对应的数据</p>
<p>InnDB的主键索引 为聚集索引，因为索引和Data都是存放在一起的，所以称为聚集索引</p>
<p>MyISAM的主键索引为非聚集索引，是因为索引和data是分别单独存储的</p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/9273.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/9273.html" itemprop="url">Nginx 编译报错：SSL modules require the OpenSSL library</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-11T09:24:56+08:00">
                2020-09-11
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <br>
<h4 id="一-编译报错">一、编译报错</h4>
<p><strong>./configure: error: SSL modules require the OpenSSL library.</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">./configure: error: SSL modules require the OpenSSL library.</span><br><span class="line">You can either <span class="keyword">do</span> not enable the modules, or install the OpenSSL library</span><br><span class="line">into the system, or build the OpenSSL library statically from the source</span><br><span class="line">with nginx by <span class="keyword">using</span> --with-openssl=&lt;path&gt; option.</span><br></pre></td></tr></table></figure>
<p>在编译Nginx的时候遇到这样的错误，环境缺少OpenSSL，需要手动安装</p>
<p><strong>CentOS</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ yum -y install openssl openssl-devel</span><br></pre></td></tr></table></figure>
<p><strong>Ubuntu</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ yum -y install openssl openssl-devel</span><br></pre></td></tr></table></figure>
<p>但是使用 <code>yum install openssl</code> 后，再次编译依然会报错</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">or build the OpenSSL library statically from the source</span><br><span class="line">with nginx by using --with-openssl=&lt;path&gt; option.</span><br></pre></td></tr></table></figure>
<p>按以上报错的提示，需要手动指定OpenSSL的安装位置</p>
<h4 id="二-openssl编译安装">二、OpenSSL编译安装</h4>
<p><strong>官网下载地址</strong></p>
<p><a href="https://www.openssl.org/source/openssl-1.1.1g.tar.gz" target="_blank" rel="noopener">https://www.openssl.org/source/openssl-1.1.1g.tar.gz</a></p>
<p>下载后解压</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> tar zxvf openssl<span class="literal">-1</span>.<span class="number">1.1</span>g.tar.gz</span><br><span class="line"><span class="variable">$</span> cd openssl<span class="literal">-1</span>.<span class="number">1.1</span>g</span><br></pre></td></tr></table></figure>
<p>配置编译安装</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> ./config -<span class="literal">-prefix</span>=/usr/local/openssl</span><br><span class="line"><span class="variable">$</span> make &amp;&amp; make install</span><br></pre></td></tr></table></figure>
<p>如果要替换<code>yum install openssl</code>安装的，请执行以下操作</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> mv /usr/bin/openssl /usr/bin/openssl.old</span><br><span class="line"><span class="variable">$</span> mv /usr/include/openssl /usr/include/openssl.old</span><br><span class="line"><span class="variable">$</span> ln <span class="literal">-s</span> /usr/local/openssl/bin/openssl /usr/bin/openssl</span><br><span class="line"><span class="variable">$</span> ln <span class="literal">-s</span> /usr/local/openssl/include/openssl /usr/include/openssl</span><br><span class="line"><span class="variable">$</span> ln <span class="literal">-s</span> /usr/local/openssl/lib/libssl.so.<span class="number">1.1</span> /usr/lib64/libssl.so.<span class="number">1.1</span></span><br><span class="line"><span class="variable">$</span> ln <span class="literal">-s</span> /usr/local/openssl/lib/libcrypto.so.<span class="number">1.1</span> /usr/lib64/libcrypto.so.<span class="number">1.1</span></span><br></pre></td></tr></table></figure>
<h2 id="三-再次编译安装nginx">三、再次编译安装Nginx</h2>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> ./configure -<span class="literal">-prefix</span>=/usr/local/nginx \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-openssl</span>=/usr/local/openssl \</span><br><span class="line">-<span class="literal">-without</span><span class="literal">-http_rewrite_module</span> \</span><br><span class="line">-<span class="literal">-without</span><span class="literal">-http_gzip_module</span> \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-http_ssl_module</span> \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-pcre</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">./configure -<span class="literal">-prefix</span>=/usr/local/nginx \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-http_gzip_static_module</span> \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-http_v2_module</span> \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-http_ssl_module</span> \</span><br><span class="line">-<span class="literal">-with</span><span class="literal">-pcre</span></span><br></pre></td></tr></table></figure>
<p><strong>fatal error: <code>openssl/ssl.h</code>: No such file or directory</strong></p>
<p>要解决这个问题，你需要安装 OpenSSL 开发包，执行以下命令进行安装，然后重新编译即可解决</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> sudo yum install openssl<span class="literal">-devel</span></span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">CORE_DEPS=&quot;$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h&quot;</span><br><span class="line"></span><br><span class="line">CORE_INCS=&quot;$CORE_INCS $OPENSSL/.openssl/include&quot;</span><br><span class="line">CORE_DEPS=&quot;$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h&quot;</span><br><span class="line">CORE_LIBS=&quot;$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a&quot;</span><br><span class="line">CORE_LIBS=&quot;$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a&quot;</span><br><span class="line">CORE_LIBS=&quot;$CORE_LIBS $NGX_LIBDL&quot;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">    server &#123;</span><br><span class="line">        listen       443 ssl;</span><br><span class="line">        server_name  zhongxc.cc www.zhongxc.cc;</span><br><span class="line"></span><br><span class="line">        ssl_certificate      ssl/fullchain.cer;</span><br><span class="line">        ssl_certificate_key  ssl/zhongxc.cc.key;</span><br><span class="line"></span><br><span class="line">    #    ssl_session_cache    shared:SSL:1m;</span><br><span class="line">    #    ssl_session_timeout  5m;</span><br><span class="line"></span><br><span class="line">    #    ssl_ciphers  HIGH:!aNULL:!MD5;</span><br><span class="line">    #    ssl_prefer_server_ciphers  on;</span><br><span class="line"></span><br><span class="line">        location / &#123;</span><br><span class="line">            root   html;</span><br><span class="line">            index  index.html index.htm;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">/usr/local/nginx/conf/conf.d</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"># openresty：已经安装了openssl，但是执行 ./configure时还是一直报：./configure: error: SSL modules require the OpenSSL library.</span><br><span class="line">https://www.cnblogs.com/Guhongying/p/11636369.html</span><br><span class="line"></span><br><span class="line"># centos中编译安装nginx并支持ssl</span><br><span class="line">https://blog.csdn.net/bjnihao/article/details/52370089</span><br><span class="line"></span><br><span class="line"># 已安装nginx支持https配置 the &quot;ssl&quot; parameter requires ngx_http_ssl_module</span><br><span class="line">https://blog.csdn.net/GMingZhou/article/details/104490684</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="快速设置-如果你知道该怎么操作-直接使用下面的地址">快速设置— 如果你知道该怎么操作，直接使用下面的地址</h4>
<p><a href="https://gitee.com/ikings/blogs.git" target="_blank" rel="noopener">https://gitee.com/ikings/blogs.git</a></p>
<p>我们强烈建议所有的git仓库都有一个<code>README</code>, <code>LICENSE</code>, <code>.gitignore</code>文件</p>
<p>Git入门？查看 <a href="https://gitee.com/oschina/git-osc/wikis/%E5%B8%AE%E5%8A%A9" target="_blank" rel="noopener">帮助</a> , <a href="https://gitee.com/help/articles/4118" target="_blank" rel="noopener">Visual Studio</a> / <a href="http://my.oschina.net/longxuu/blog/141699" target="_blank" rel="noopener">TortoiseGit</a> / <a href="https://gitee.com/help/articles/4119" target="_blank" rel="noopener">Eclipse</a> / <a href="http://my.oschina.net/zxs/blog/142544" target="_blank" rel="noopener">Xcode</a> 下如何连接本站, <a href="http://www.oschina.net/question/82993_133520" target="_blank" rel="noopener">如何导入仓库</a></p>
<h4 id="简易的命令行入门教程">简易的命令行入门教程:</h4>
<p>Git 全局设置:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name &quot;king&apos;s&quot;</span><br><span class="line">git config --global user.email &quot;cqzhongxc@hotmail.com&quot;</span><br></pre></td></tr></table></figure>
<p>创建 git 仓库:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">mkdir blogs</span><br><span class="line">cd blogs</span><br><span class="line">git init</span><br><span class="line">touch README.md</span><br><span class="line">git add README.md</span><br><span class="line">git commit -m &quot;first commit&quot;</span><br><span class="line">git remote add origin https://gitee.com/ikings/blogs.git</span><br><span class="line">git push -u origin master</span><br></pre></td></tr></table></figure>
<p>已有仓库?</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">cd existing_git_repo</span><br><span class="line">git remote add origin https://gitee.com/ikings/blogs.git</span><br><span class="line">git push -u origin master</span><br></pre></td></tr></table></figure>
          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/64139.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/64139.html" itemprop="url">MySQL表分区</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-09T14:34:46+08:00">
                2020-09-09
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <br>
<h3 id="前言">前言</h3>
<p>主要参考与MySQL官方文档</p>
<p><a href="https://dev.mysql.com/doc/mysql-partitioning-excerpt/8.0/en/partitioning.html" target="_blank" rel="noopener">https://dev.mysql.com/doc/mysql-partitioning-excerpt/8.0/en/partitioning.html</a></p>
<h4 id="一-为什么要采用表分区">一、为什么要采用表分区</h4>
<p>当数据量过大的时候（通常是指百万级或千万级数据的时候），这个时候需要将一张表的数据划分几张表存储，一些查询可以得到极大的优化，这主要是借助于满足一个给定WHERE语句的数据可以只保存在一个或多个分区内，这样在查找时就不用查找其他剩余的分区。</p>
<h4 id="二-什么是分区">二、什么是分区</h4>
<p>通俗地讲表分区是将一大表，根据条件分割成若干个小表</p>
<h4 id="三-查看mysql是否支持分区">三、查看MySQL是否支持分区</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"># 通过以下命令去查看mysql是否支持分区</span><br><span class="line">SHOW VARIABLES LIKE &apos;%partition%&apos;</span><br><span class="line"># 如果输出的变量为yes表示mysql是支持分区的</span><br></pre></td></tr></table></figure>
<h4 id="四-分区的类型">四、分区的类型</h4>
<p><strong>Range分区</strong></p>
<blockquote>
<p>RANGE分区，基于属于一个给定连续区间的列值，把多行分配给分区。</p>
</blockquote>
<p><strong>List分区</strong></p>
<blockquote>
<p>LIST分区，类似于按RANGE分区，区别在于LIST分区是基于列值匹配一个离散值集合中的某个值来进行选择</p>
</blockquote>
<p><strong>HASH分区</strong></p>
<blockquote>
<p>HASH分区，基于用户定义的表达式的返回值来进行选择的分区，该表达式使用将要插入到表中的这些行的列值进行计算，这个函数可以包含MySQL中有效的、产生非负整数值的任何表达式</p>
</blockquote>
<p><strong>KEY分区</strong></p>
<blockquote>
<p>KEY分区，类似于按HASH分区，区别在于KEY分区只支持计算一列或多列，且MySQL服务器提供其自身的哈希函数，必须有一列或多列包含整数值</p>
</blockquote>
<h4 id="五-创建表分区">五、创建表分区</h4>
<p><strong>RANGE分区</strong></p>
<p>按照range分区的表是通过如下一种方式进行分区的，每个分区包含哪些分区表达式的值位于一个给定的连续区间内的行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE employee(</span><br><span class="line">		id INT NOT NULL,</span><br><span class="line">		fname VARCHAR(30) DEFAULT NULL,</span><br><span class="line">		lname VARCHAR(30) DEFAULT NULL,</span><br><span class="line">		hired DATE NOT NULL DEFAULT &apos;1970-01-01&apos;,</span><br><span class="line">		separated DATE NOT NULL DEFAULT &apos;9999-12-31&apos;,</span><br><span class="line">		job_code INT NOT NULL,</span><br><span class="line">		store_id INT NOT NULL</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line">PARTITION BY RANGE (store_id) (</span><br><span class="line">		PARTITION p0 VALUES LESS THAN (6),</span><br><span class="line">		PARTITION p1 VALUES LESS THAN (11),</span><br><span class="line">		PARTITION p2 VALUES LESS THAN (16),</span><br><span class="line">		PARTITION p3 VALUES LESS THAN MAXVALUE</span><br><span class="line">);</span><br></pre></td></tr></table></figure>
<p><code>MAXVALUE</code>表示一个始终大于最大可能整数值的整数值（在数学语言中，它用作 最小上限）。现在，任何<code>store_id</code>列值大于或等于16（定义的最大值）的行都存储在partition中<code>p3</code>。在将来的某个时候（当存储数量增加到25、30或更多时），您可以使用一条 <a href="https://dev.mysql.com/doc/refman/8.0/en/alter-table-partition-operations.html" target="_blank" rel="noopener"><code>ALTER TABLE</code></a>语句为存储21-25、26-30等添加新的分区。</p>
<p><strong>查询表分区信息</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">SELECT * FROM information_schema.`PARTITIONS` </span><br><span class="line">WHERE table_schema=&apos;xx_admin&apos; AND TABLE_NAME=&apos;employee&apos;</span><br></pre></td></tr></table></figure>
<p><img src="/assets/images/range-1.png" alt></p>
<p>可以看到employee表有p0~p3 4个表分区</p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/31313.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/31313.html" itemprop="url">Docker安装Redis集群</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-09T11:42:37+08:00">
                2020-09-09
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <br>
<h4 id="docker搭建redis集群">Docker搭建Redis集群</h4>
<p>搭建3主3从redis 服务架构</p>
<h4 id="一-先创建6个redis-服务">一、先创建6个Redis 服务</h4>
<p>我们搭建一个3主3从集群，其中从服务主要为同步备份，主服务进行数据分片，我们为了方便快捷创建出集群，我们执行以下命令即可为我们创建出端口为7001～7006，6个redis服务。</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 复制以下命令，创建出6个Redis服务</span></span><br><span class="line"><span class="keyword">for</span> port <span class="keyword">in</span> <span class="variable">$</span>(seq <span class="number">7001</span> <span class="number">7006</span>);  \</span><br><span class="line"><span class="keyword">do</span> \</span><br><span class="line">mkdir <span class="literal">-p</span> /mydata/redis/node-<span class="variable">$</span>&#123;port&#125;/conf</span><br><span class="line">touch /mydata/redis/node-<span class="variable">$</span>&#123;port&#125;/conf/redis.conf</span><br><span class="line">cat &lt;&lt; EOF &gt; /mydata/redis/node-<span class="variable">$</span>&#123;port&#125;/conf/redis.conf</span><br><span class="line">port <span class="variable">$</span>&#123;port&#125;</span><br><span class="line">cluster<span class="literal">-enabled</span> yes</span><br><span class="line">cluster<span class="literal">-config</span><span class="operator">-file</span> nodes.conf</span><br><span class="line">cluster<span class="literal">-node</span><span class="literal">-timeout</span> <span class="number">5000</span></span><br><span class="line">cluster<span class="literal">-announce</span><span class="literal">-ip</span> <span class="number">192.168</span>.<span class="number">1.119</span></span><br><span class="line">cluster<span class="literal">-announce</span><span class="literal">-port</span> <span class="variable">$</span>&#123;port&#125;</span><br><span class="line">cluster<span class="literal">-announce</span><span class="literal">-bus</span><span class="literal">-port</span> <span class="number">1</span><span class="variable">$</span>&#123;port&#125;</span><br><span class="line">appendonly yes <span class="comment">#开启持久AOF</span></span><br><span class="line">EOF</span><br><span class="line">docker run <span class="literal">-p</span> <span class="variable">$</span>&#123;port&#125;:<span class="variable">$</span>&#123;port&#125; <span class="literal">-p</span> <span class="number">1</span><span class="variable">$</span>&#123;port&#125;:<span class="number">1</span><span class="variable">$</span>&#123;port&#125; \</span><br><span class="line">-<span class="literal">-name</span> redis-<span class="variable">$</span>&#123;port&#125; -<span class="literal">-restart</span> always \</span><br><span class="line"><span class="literal">-v</span> /mydata/redis/node-<span class="variable">$</span>&#123;port&#125;/<span class="keyword">data</span>:/<span class="keyword">data</span> \</span><br><span class="line"><span class="literal">-v</span> /mydata/redis/node-<span class="variable">$</span>&#123;port&#125;/conf/redis.conf:/etc/redis/redis.conf \</span><br><span class="line"><span class="literal">-d</span> redis:<span class="number">5.0</span>.<span class="number">7</span> redis<span class="literal">-server</span> /etc/redis/redis.conf; \</span><br><span class="line">done</span><br><span class="line"></span><br><span class="line"><span class="comment"># 停止docker redis容器服务</span></span><br><span class="line"><span class="variable">$</span> docker stop <span class="variable">$</span>(docker ps <span class="literal">-a</span>|grep redis<span class="literal">-700</span>|awk <span class="string">'&#123;print$1&#125;'</span>) </span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除docker redis容器服务,加-f代表强制删除，可以删掉未停止的服务* </span></span><br><span class="line"><span class="variable">$</span> docker rm <span class="operator">-f</span> <span class="variable">$</span>(docker ps <span class="literal">-a</span>|grep redis<span class="literal">-700</span>|awk <span class="string">'&#123;print$1&#125;'</span>)</span><br></pre></td></tr></table></figure>
<p><strong>注意：</strong>–restart always 代表随docker服务启动而自启动。如果不需要则可以删掉。另外如果设置后，可以通过docker update --restart=no 容器ID 命令修改参数为不自启动，restart参数说明如下：</p>
<ul>
<li>no 不自动重启</li>
<li>on-failure:重启次数 指定自动重启的失败次数,到达失败次数后不再重启</li>
<li>always 自动重启</li>
</ul>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># docker update --restart=no [容器名] </span></span><br><span class="line"><span class="comment"># docker update --restart=always [容器名]</span></span><br><span class="line"><span class="comment"># docker update --restart=on-failure:3 [容器名]</span></span><br><span class="line"><span class="comment"># 如需要批量修改容器参数，使用以下命令修改即可</span></span><br><span class="line"><span class="variable">$</span> docker update -<span class="literal">-restart</span>=no  <span class="variable">$</span>(docker ps <span class="literal">-a</span>|grep redis<span class="literal">-700</span>|awk <span class="string">'&#123;print$1&#125;'</span>)</span><br></pre></td></tr></table></figure>
<h4 id="二-开始配置redis集群">二、开始配置redis集群</h4>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 随意进入redis服务(预设master服务)</span></span><br><span class="line"><span class="variable">$</span> docker exec <span class="literal">-it</span> redis<span class="literal">-7001</span> /bin/bash</span><br><span class="line"></span><br><span class="line"><span class="comment"># 执行集群命令,--cluster-replicas 1 我们这里是一个副本</span></span><br><span class="line"><span class="variable">$</span> redis<span class="literal">-cli</span> -<span class="literal">-cluster</span> create \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7001</span> \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7002</span> \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7003</span> \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7004</span> \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7005</span> \</span><br><span class="line"><span class="number">192.168</span>.<span class="number">15.128</span>:<span class="number">7006</span> \</span><br><span class="line">-<span class="literal">-cluster</span><span class="literal">-replicas</span> <span class="number">1</span></span><br></pre></td></tr></table></figure>
<p>注：</p>
<ul>
<li>IP地址为你创建redis容器的IP，端口为各容器开放端口，不同服务期可以端口一样，前提IP不通</li>
<li>参数–cluster-replicas 1表示给每个主节点配置一个从节点 0 代表不创建从节点</li>
</ul>
<p>到此集群搭建完成。</p>
<h4 id="三-查询集群状态">三、查询集群状态</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cluster info</span><br></pre></td></tr></table></figure>
<h4 id="四-查看集群节点信息">四、查看集群节点信息</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cluster nodes</span><br></pre></td></tr></table></figure>
<h4 id="五-查看集群插槽">五、查看集群插槽</h4>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cluster slots</span><br></pre></td></tr></table></figure>
          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/3117.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/3117.html" itemprop="url">Docker如何批量删除镜像</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-09T10:57:35+08:00">
                2020-09-09
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <br>
<h4 id="一-批量删除指定关键字的镜像">一、 批量删除指定关键字的镜像</h4>
<p>docker 使用一段时间之后，可能堆积很多用不着的，或者编译错误的镜像，一个一个删除就很麻烦，需要一个批量删除的方法，如下：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> docker rmi <span class="variable">$</span>(docker images | grep <span class="string">"none"</span> | awk <span class="string">'&#123;print $3&#125;'</span>)</span><br></pre></td></tr></table></figure>
<p>上面这条命令，可以删除所有名字中带 “none” 关键字的镜像。</p>
<p>这个 grep 后面的参数，就是筛选出名字中包含这个参数的镜像。</p>
<p>即可以通过这条命令，删除所有名字中包含此参数的镜像。</p>
<h4 id="二-删除所有未运行的容器">二、删除所有未运行的容器</h4>
<p>已经运行的删除不了，未运行的就一起被删除了</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> docker rm <span class="variable">$</span>(sudo docker ps <span class="literal">-a</span> <span class="literal">-q</span>)</span><br></pre></td></tr></table></figure>
<h4 id="三-根据容器的状态-删除exited状态的容器">三、根据容器的状态，删除Exited状态的容器</h4>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> docker rm <span class="variable">$</span>(sudo docker ps <span class="literal">-qf</span> status=exited)</span><br></pre></td></tr></table></figure>
<h4 id="四-删除所有的镜像">四、删除所有的镜像</h4>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> docker rmi <span class="variable">$</span>(docker images <span class="literal">-q</span>)</span><br></pre></td></tr></table></figure>
<h4 id="镜像操作">镜像操作</h4>
<ol>
<li>
<p>创建项目Dockerfile</p>
</li>
<li>
<p>上传项目到服务器</p>
</li>
<li>
<p>进入项目，构建镜像到本地仓库</p>
<p>3.1 docker build -t nginx:v1.0 -f ./Dockerfile . 别忘了最后小数点</p>
<p>3.2 docker images 查看镜像</p>
<p>3.3 docker exec -it 容器ID /bin/bash 进入容器</p>
<p>3.4 docker commit -a &quot;cqzhongxc&quot; -m &quot;nginx&quot; 容器ID nginx:v1.0</p>
</li>
</ol>
<h4 id="五-查看docker容器的信息">五、查看Docker容器的信息</h4>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$</span> docker inspect tomcat001</span><br></pre></td></tr></table></figure>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/33460.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/33460.html" itemprop="url">ElasticSearch可视化工具Dejavu安装使用</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-09T10:36:27+08:00">
                2020-09-09
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p>Dejavu 是一个 ElasticSearch 的 Web UI 工具，支持通过 JSON 和 CSV 文件导入数据，支持可视化定义 Mapping (字段映射)等。</p>
<p>相关描述在 <a href="https://github.com/appbaseio/dejavu/" target="_blank" rel="noopener">https://github.com/appbaseio/dejavu/</a> 上都有详细描述，这里只是做个简单的记录。</p>
<h4 id="1-安装-docker-环境">1、安装 Docker 环境</h4>
<p>这里就不细述了，网上有很多相关的资料。</p>
<ul>
<li><a href="https://www.runoob.com/docker/centos-docker-install.html" target="_blank" rel="noopener">CentOS Docker 安装</a></li>
<li><a href="https://www.runoob.com/docker/ubuntu-docker-install.html" target="_blank" rel="noopener">Ubuntu Docker 安装</a></li>
<li><a href="https://www.runoob.com/docker/docker-mirror-acceleration.html" target="_blank" rel="noopener">Docker 镜像加速</a></li>
</ul>
<p>也可以不使用 Docker ，会比较麻烦一点。</p>
<h4 id="2-运行-elasticsearch-服务">2、运行 ElasticSearch 服务</h4>
<p>如果已经存在 <strong>ElasticSearch</strong> 服务，那么只需要确保其启用了 <strong>CORS</strong> (跨域)设置即可。</p>
<p>启用方式为，在 <code>elasticsearch.yml</code> 配置文件中添加以下几行：</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">http.port:</span> <span class="number">9200</span></span><br><span class="line"><span class="attr">http.cors.allow-origin:</span> <span class="string">'http://localhost:1358'</span></span><br><span class="line"><span class="attr">http.cors.enabled:</span> <span class="literal">true</span></span><br><span class="line"><span class="attr">http.cors.allow-headers:</span> <span class="string">X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization</span></span><br><span class="line"><span class="attr">http.cors.allow-credentials:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure>
<p>如果不存在 <strong>ElasticSearch</strong> 服务的情况下，则可运行下面命令运行一个 <strong>ElasticSearch</strong> 的 <strong>docker</strong> 容器</p>
<p><strong>ElasticSearch 2.x</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -<span class="literal">-name</span> elasticsearch <span class="literal">-p</span> <span class="number">9200</span>:<span class="number">9200</span> <span class="literal">-d</span> elasticsearch:<span class="number">2</span> <span class="literal">-Des</span>.http.port=<span class="number">9200</span> <span class="literal">-Des</span>.http.cors.allow<span class="literal">-origin</span>=<span class="string">"http://localhost:1358"</span> <span class="literal">-Des</span>.http.cors.enabled=true <span class="literal">-Des</span>.http.cors.allow<span class="literal">-headers</span>=X<span class="literal">-Requested</span><span class="literal">-With</span>,X<span class="literal">-Auth</span><span class="literal">-Token</span>,Content<span class="literal">-Type</span>,Content<span class="literal">-Length</span>,Authorization <span class="literal">-Des</span>.http.cors.allow<span class="literal">-credentials</span>=true</span><br></pre></td></tr></table></figure>
<p><strong>ElasticsSarch 5.x</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run --name elasticsearch -p 9200:9200 -d elasticsearch:5 -E http.port=9200 -E http.cors.allow-origin=&quot;http://localhost:1358&quot; -E http.cors.enabled=true -E http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -E http.cors.allow-credentials=true</span><br></pre></td></tr></table></figure>
<p><strong>ElasticSearch 6.x</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -p 9200:9200 -d elasticsearch docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4 -Ehttp.port=9200 -Ehttp.cors.enabled=true -Ehttp.cors.allow-origin=http://localhost:1358 -Ehttp.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -Ehttp.cors.allow-credentials=true</span><br></pre></td></tr></table></figure>
<p><strong>ElasticSearch 7.x</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -d --rm --name elasticsearch -p 9200:9200 -p 9300:9300 -e &quot;discovery.type=single-node&quot; -e &quot;http.cors.enabled=true&quot; -e &quot;http.cors.allow-origin=*&quot; -e &quot;http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization&quot; -e &quot;http.cors.allow-credentials=true&quot; docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.1</span><br></pre></td></tr></table></figure>
<p>安装完成后可以使用下面命令创建一个新索引</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -X PUT http://ip:9200/test</span><br></pre></td></tr></table></figure>
<h4 id="3-安装运行-dejavu-服务">3、安装运行 Dejavu 服务</h4>
<p>使用 <strong>docker</strong> 安装 <strong>Dejavu</strong> 服务</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -p 1358:1358 -d appbaseio/dejavu</span><br></pre></td></tr></table></figure>
<p>安装完成后可以使用浏览器打开 <code>http://ip:1358</code> 使用。</p>
<p><img src="/assets/images/dejavu1.png" alt></p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhongxc.cc/10468.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="King">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/assets/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="King blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
                
                <a class="post-title-link" href="/10468.html" itemprop="url">VSCode新建vue模版</a></h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-09-03T14:39:18+08:00">
                2020-09-03
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2021-04-20T09:26:05+08:00">
                2021-04-20
              </time>
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <br>
<h4 id="前言">前言</h4>
<p>每次新建一个vue文件！都要重行敲打一遍template。script。style。神烦！有没有和别的编辑器一样！设置自己默认的模板！</p>
<h4 id="一-安装vscode">一、安装vscode</h4>
<p>官网下载地址</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://code.visualstudio.com/</span><br></pre></td></tr></table></figure>
<h4 id="二-安装一个插件-识别vue文件">二、安装一个插件，识别vue文件</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">插件库中搜索Vetur，下图中的第一个，点击安装，安装完成之后点击重新加载</span><br></pre></td></tr></table></figure>
<h4 id="三-新建代码片段">三、新建代码片段</h4>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">文件--&gt;首选项--&gt;用户代码片段--&gt;点击新建代码片段--取名vue.json 确定</span><br></pre></td></tr></table></figure>
<p><img src="/assets/images/vetur.png" alt></p>
<h4 id="四-粘入自己写的-vue模板">四、粘入自己写的.vue模板</h4>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    <span class="attr">"Print to console"</span>: &#123;</span><br><span class="line">        <span class="attr">"prefix"</span>: <span class="string">"vue"</span>,</span><br><span class="line">        <span class="attr">"body"</span>: [</span><br><span class="line">            <span class="string">"&lt;!-- $1 --&gt;"</span>,</span><br><span class="line">            <span class="string">"&lt;template&gt;"</span>,</span><br><span class="line">            <span class="string">"&lt;div class='$2'&gt;$5&lt;/div&gt;"</span>,</span><br><span class="line">            <span class="string">"&lt;/template&gt;"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"&lt;script&gt;"</span>,</span><br><span class="line">            <span class="string">"// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）"</span>,</span><br><span class="line">            <span class="string">"// 例如：import 《组件名称》 from '《组件路径》';"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"export default &#123;"</span>,</span><br><span class="line">            <span class="string">"// import引入的组件需要注入到对象中才能使用"</span>,</span><br><span class="line">            <span class="string">"components: &#123;&#125;,"</span>,</span><br><span class="line">            <span class="string">"data() &#123;"</span>,</span><br><span class="line">            <span class="string">"// 这里存放数据"</span>,</span><br><span class="line">            <span class="string">"return &#123;"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"&#125;;"</span>,</span><br><span class="line">            <span class="string">"&#125;,"</span>,</span><br><span class="line">            <span class="string">"// 监听属性 类似于data概念"</span>,</span><br><span class="line">            <span class="string">"computed: &#123;&#125;,"</span>,</span><br><span class="line">            <span class="string">"// 监控data中的数据变化"</span>,</span><br><span class="line">            <span class="string">"watch: &#123;&#125;,"</span>,</span><br><span class="line">            <span class="string">"// 方法集合"</span>,</span><br><span class="line">            <span class="string">"methods: &#123;"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"&#125;,"</span>,</span><br><span class="line">            <span class="string">"// 生命周期 - 创建完成（可以访问当前this实例）"</span>,</span><br><span class="line">            <span class="string">"created() &#123;"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"&#125;,"</span>,</span><br><span class="line">            <span class="string">"// 生命周期 - 挂载完成（可以访问DOM元素）"</span>,</span><br><span class="line">            <span class="string">"mounted() &#123;"</span>,</span><br><span class="line">            <span class="string">""</span>,</span><br><span class="line">            <span class="string">"&#125;,"</span>,</span><br><span class="line">            <span class="string">"beforeCreate() &#123;&#125;, // 生命周期 - 创建之前"</span>,</span><br><span class="line">            <span class="string">"beforeMount() &#123;&#125;, // 生命周期 - 挂载之前"</span>,</span><br><span class="line">            <span class="string">"beforeUpdate() &#123;&#125;, // 生命周期 - 更新之前"</span>,</span><br><span class="line">            <span class="string">"updated() &#123;&#125;, // 生命周期 - 更新之后"</span>,</span><br><span class="line">            <span class="string">"beforeDestroy() &#123;&#125;, // 生命周期 - 销毁之前"</span>,</span><br><span class="line">            <span class="string">"destroyed() &#123;&#125;, // 生命周期 - 销毁完成"</span>,</span><br><span class="line">            <span class="string">"activated() &#123;&#125;, // 如果页面有keep-alive缓存功能，这个函数会触发"</span>,</span><br><span class="line">            <span class="string">"&#125;"</span>,</span><br><span class="line">            <span class="string">"&lt;/script&gt;"</span>,</span><br><span class="line">            <span class="string">"&lt;style lang='scss' scoped&gt;"</span>,</span><br><span class="line">            <span class="string">"// @import url($3); 引入公共css类"</span>,</span><br><span class="line">            <span class="string">"$4"</span>,</span><br><span class="line">            <span class="string">"&lt;/style&gt;"</span></span><br><span class="line">        ],</span><br><span class="line">        <span class="attr">"description"</span>: <span class="string">"Log output to console"</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>上面代码中的 &quot;prefix&quot;: &quot;vue&quot;, 就是快捷键；保存好之后，新建.vue结尾的文件试试</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">输入vue 按键盘的tab就行</span><br></pre></td></tr></table></figure>
<p>模板创建完毕。</p>

          
        
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </div>
  
  
  
  </article>


    
  </section>

  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/page/4/"><i class="fa fa-angle-left"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/4/">4</a><span class="page-number current">5</span><a class="page-number" href="/page/6/">6</a><a class="page-number" href="/page/7/">7</a><a class="extend next" rel="next" href="/page/6/"><i class="fa fa-angle-right"></i></a>
  </nav>



          </div>
          


          

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview sidebar-panel sidebar-panel-active">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          
            <img class="site-author-image" itemprop="image" src="/assets/images/avatar.jpg" alt="King">
          
            <p class="site-author-name" itemprop="name">King</p>
            <p class="site-description motion-element" itemprop="description"></p>
        </div>

        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
            
              <a href="/archives/">
            
                <span class="site-state-item-count">61</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">16</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">34</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/crytostring" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="mailto:cqzhongxc@outlook.com" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://gitee.com/ikings" target="_blank" title="gitee">
                  
                    <i class="fa fa-fw fa-git"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.stephen520.cn" target="_blank" title="石鹏">
                  
                    <i class="fa fa-fw fa-scribd"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.tutorialspoint.com/index.htm" target="_blank" title="tutorialspoint">
                  
                    <i class="fa fa-fw fa-tumblr"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://leetcode-cn.com/interview" target="_blank" title="leetcode">
                  
                    <i class="fa fa-fw fa-code"></i></a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.geeksforgeeks.org/php-addcslashes-function" target="_blank" title="geeksforgeeks">
                  
                    <i class="fa fa-fw fa-diamond"></i></a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">
  
  &copy;  2020 &mdash; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-random"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">King</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动</div>

  <span class="post-meta-divider">|</span>

  <div class="theme-info">主题 &mdash; <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.2</div>


        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  

  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>


  

  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  

  






  




	





  








  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('3');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

  
  <script type="text/javascript" src="/js/src/exturl.js?v=5.1.2"></script>


</body>
</html>
